package com.yjzx.care.base;

import java.util.function.BooleanSupplier;

/**
 * @author yjzx
 * @description LambdaElement
 * @since 2025/6/19
 */
public class LambdaElement<T> implements Element<T>{
    BooleanSupplier supplier;
    T value;

    public LambdaElement(BooleanSupplier supplier, T value) {
        this.supplier = supplier;
        this.value = value;
    }

    @Override
    public T getValue() {
        return supplier.getAsBoolean() ? value : null;
    }
}
